function getDoc(xmlfile, xmlonload, ref)
{
	var xhr;

	try
	{
		xhr = new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch(e)
	{
		xhr = new XMLHttpRequest();
	}

	xhr.ref = ref;

	xhr.onreadystatechange = function()
	{
		if(xhr.readyState == 4)
		{
			if(xhr.status == 200)
			{
				xmlonload(xhr);
			} else
			{
				alert("An error has occurred while loading data file");
			} 
		}
	}

	xhr.open("GET", xmlfile, false);
	xhr.send(null);
}

function debug(info)
{
	document.getElementById("debug").innerHTML += info+"<br />\n";
}


quat4.createFromAxis = function(angle, axis)
{
	
	var q = new glMatrixArrayType(4);

	var sin_a = Math.sin(angle / 2);
	var cos_a = Math.cos(angle / 2);

	q[0] = axis[0] * sin_a;
	q[1] = axis[1] * sin_a;
	q[2] = axis[2] * sin_a;
	q[3] = cos_a;
	
	return q;
}
